<?php

/**
 * Discount form base class.
 *
 * @method Discount getObject() Returns the current form's model object
 *
 * @package    photobook
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDiscountForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'discount_type'    => new sfWidgetFormInputText(),
      'title'            => new sfWidgetFormInputText(),
      'content'          => new sfWidgetFormTextarea(),
      'from_date'        => new sfWidgetFormDate(),
      'to_date'          => new sfWidgetFormDate(),
      'discount_status'  => new sfWidgetFormInputCheckbox(),
      'banner'           => new sfWidgetFormInputText(),
      'is_view_homepage' => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'discount_type'    => new sfValidatorInteger(),
      'title'            => new sfValidatorString(array('max_length' => 255)),
      'content'          => new sfValidatorString(array('max_length' => 4000)),
      'from_date'        => new sfValidatorDate(),
      'to_date'          => new sfValidatorDate(),
      'discount_status'  => new sfValidatorBoolean(array('required' => false)),
      'banner'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'is_view_homepage' => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('discount[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Discount';
  }

}
